package com.lagou.config;

import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SolrConfig {
    @Value("${spring.data.solr.zk-host}")
    private  String  zkHost;
    @Bean
    public CloudSolrClient solrClient(){
        CloudSolrClient  cloudSolrClient = new CloudSolrClient.Builder().withZkHost(zkHost).build();
        cloudSolrClient.setDefaultCollection("mycollection");
        return  cloudSolrClient;
    }
}
